//
//  MyWalletBottomView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/5.
//  Copyright © 2018年 yang. All rights reserved.
//

#import "MyWalletBottomView.h"

@implementation MyWalletBottomView

- (id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView
{
    if (self = [super initWithFrame:aFrame inSuperView:aSuperView]) {
        self.backgroundColor = [UIColor whiteColor];
        
        CGFloat btnW = aFrame.size.width / 4;
        CGFloat btnH = aFrame.size.height / 2;
        CGFloat btnY = 0;
        NSArray *arr = @[@"余额提现", @"佣金提现", @"提现记录", @"我的银行卡", @"佣金明细", @"收支明细"];
        NSArray *imgArr = @[@"icon_yuetixian", @"icon_yongjintixian", @"icon_tixianjilu", @"icon_wodeyinhangka", @"icon_yongjinmingxi", @"icon_shouzhimingxi"];

        for (int i = 0; i < 6; i ++) {
            CGFloat btnX = i * btnW;
            if (i >= 4) {
                NSInteger newI = i - 4;
                btnX = newI * btnW;
                btnY = btnH;
            }
            GLGWButton *btn = [[GLGWButton alloc] initWithTitleLableFontType:SYSTEMFONT(12) titleColor:[UIColor colorWithHexString:@"#666666"] inSuperView:self];
            [btn mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(@(btnX));
                make.top.equalTo(@(btnY));
                make.width.equalTo(@(btnW));
                make.height.equalTo(@(btnH));
            }];
            NSString *btnStr = [NSString stringWithFormat:@"%@",arr[i]];
            [btn setTitle:btnStr forState:UIControlStateNormal];
            NSString *imgStr = imgArr[i];
            [btn setImage:[UIImage imageNamed:imgStr] forState:UIControlStateNormal];
            [btn setImagePositionWithType:SSImagePositionTypeTop spacing:11];
            [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            btn.tag = 460 + i;
        
        }
    }
    return self;
}

- (void)btnAction:(GLGWButton *)sender
{
    if (self.BlockBtn) {
        self.BlockBtn(sender);
    }
}

@end
